<template>
  <el-dialog title="联单信息" :close-on-click-modal="false" :visible.sync="visible" @close="closePop">
    <div>
      <el-form
        :model="ruleForm"
        :rules="rules"
        ref="ruleForm"
        label-width="100px"
        class="demo-ruleForm"
      >
        <el-form-item label="手机号" prop="picContact">
          <el-input v-model="ruleForm.picContact" clearable></el-input>
        </el-form-item>
        <!-- <el-form-item label="密码" prop="password">
          <el-input v-model="ruleForm.password" show-password></el-input>
        </el-form-item>-->
      </el-form>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="closePop('ruleForm')">取消</el-button>
      <el-button type="primary" @click="submitForm('ruleForm')">确定</el-button>
    </span>
  </el-dialog>
</template>
  
  <script>
import { addTransportationCompanyUser } from "@/api/modules/transportationCompany.js";
export default {
  props: {
    visible: Boolean,
    info: Object
  },
  data() {
    return {
      loading: true,
      ruleForm: {
        picContact: "",
        // password: "",
        id: ""
      },
      rules: {
        picContact: [
          { required: true, message: "请填写手机号", trigger: "blur" }
        ]
      }
    };
  },
  created() {
    // console.log(this.visible, this.info);
    this.ruleForm.picContact = this.info.picContact;
    this.ruleForm.id = this.info.id;
  },
  methods: {
    submitForm(formName) {
      let that = this;
      this.$refs[formName].validate(valid => {
        if (valid) {
          addTransportationCompanyUser(that.ruleForm).then(res => {
            that.$message("操作成功");

            that.$emit("resetQuery");
          });
        }
      });
    },
    // 关闭弹窗
    closePop(formName) {
      this.$refs[formName].resetFields();
      this.$emit("closePop");
    }
  }
};
</script>
  